package com.ruoyi.wms.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wms.domain.WmsInventoryLog;
import com.ruoyi.wms.mapper.WmsInventoryLogMapper;
import com.ruoyi.wms.service.IWmsInventoryLogService;

/**
 * 库存操作日志Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-12
 */
@Service
public class WmsInventoryLogServiceImpl implements IWmsInventoryLogService 
{
    @Autowired
    private WmsInventoryLogMapper wmsInventoryLogMapper;

    /**
     * 查询库存操作日志
     * 
     * @param logId 库存操作日志主键
     * @return 库存操作日志
     */
    @Override
    public WmsInventoryLog selectWmsInventoryLogById(Long logId)
    {
        return wmsInventoryLogMapper.selectWmsInventoryLogById(logId);
    }

    /**
     * 查询库存操作日志列表
     * 
     * @param wmsInventoryLog 库存操作日志
     * @return 库存操作日志
     */
    @Override
    public List<WmsInventoryLog> selectWmsInventoryLogList(WmsInventoryLog wmsInventoryLog)
    {
        // 设置租户ID
        wmsInventoryLog.setTenantId(SecurityUtils.getTenantId());
        return wmsInventoryLogMapper.selectWmsInventoryLogList(wmsInventoryLog);
    }

    /**
     * 新增库存操作日志
     * 
     * @param wmsInventoryLog 库存操作日志
     * @return 结果
     */
    @Override
    public int insertWmsInventoryLog(WmsInventoryLog wmsInventoryLog)
    {
        // 设置租户ID和创建信息
        wmsInventoryLog.setTenantId(SecurityUtils.getTenantId());
        wmsInventoryLog.setCreateBy(SecurityUtils.getUsername());
        wmsInventoryLog.setCreateTime(DateUtils.getNowDate());
        return wmsInventoryLogMapper.insertWmsInventoryLog(wmsInventoryLog);
    }

    /**
     * 修改库存操作日志
     * 
     * @param wmsInventoryLog 库存操作日志
     * @return 结果
     */
    @Override
    public int updateWmsInventoryLog(WmsInventoryLog wmsInventoryLog)
    {
        wmsInventoryLog.setUpdateBy(SecurityUtils.getUsername());
        wmsInventoryLog.setUpdateTime(DateUtils.getNowDate());
        return wmsInventoryLogMapper.updateWmsInventoryLog(wmsInventoryLog);
    }

    /**
     * 批量删除库存操作日志
     * 
     * @param logIds 需要删除的库存操作日志主键
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryLogByIds(Long[] logIds)
    {
        return wmsInventoryLogMapper.deleteWmsInventoryLogByIds(logIds);
    }

    /**
     * 删除库存操作日志信息
     * 
     * @param logId 库存操作日志主键
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryLogById(Long logId)
    {
        return wmsInventoryLogMapper.deleteWmsInventoryLogById(logId);
    }



    /**
     * 记录库存操作日志
     * 
     * @param wmsInventoryLog 库存操作日志
     * @return 结果
     */
    @Override
    public int recordInventoryLog(WmsInventoryLog wmsInventoryLog)
    {
        return insertWmsInventoryLog(wmsInventoryLog);
    }
}